home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 129_01.zip / 210CTDL.H < prev    next >
Text File  |  1993-06-01  |  15KB  |  434 lines

  1. /*                Ctdl210.h                */
  2. /*    #include file for all Citadel C files.                */
  3.  
  4. /*                #defines        82Dec10 dvm    */
  5. /*                                    */
  6. /* #defs supported in current system:                    */
  7. /*                                    */
  8. /* #def FDC-1 for the TeleTek (dvm code)                */
  9. /* #def VFC-2 for the Big Board (dvm code)                */
  10. /*                                    */
  11. /* #def TEST for special small-scale test version            */
  12.  
  13.  
  14. char firstExtern;    /* this should ALWAYS be the first declaration    */
  15.  
  16. char mData;            /* Modem data port            */
  17.  
  18. char megaHz;            /* Z80 clock rate (for wait loops)    */
  19. unsigned secondsfactor;     /* 8085 needs different from 8080/Z80    */
  20.  
  21. char *nodeName;
  22. char *nodeTitle;
  23. char *nodeId;
  24.  
  25. int  cryptSeed;
  26. char rcpm;            /* TRUE to run in RCP/M mode        */
  27. char clock;            /* TRUE  if we have a hardware clock    */
  28.  
  29. char homeDisk, homeUser, msgDisk;    /* where we keep our data files */
  30. char ourDisk, ourUser;            /* where we are just now    */
  31.  
  32. char unlogEnterOk;        /* TRUE if OK to enter messages anon    */
  33. char unlogReadOk;        /* TRUE if unlogged folks can read mess */
  34. char unlogLoginOk;        /* TRUE if spontan. new accounts ok.    */
  35. char nonAideRoomOk;        /* TRUE general folks can make rooms    */
  36. char noMail;            /* TRUE if mail is not allowed        */
  37.  
  38. /* Citadel programs use readSysTab() and writeSysTab() to write an    */
  39. /* image of the external variables in RAM to disk, and later restore    */
  40. /* it.    The image is stored in ctdlTabl.sys .  If ctdlTabl.sys is lost, */
  41. /* sysop.com will automatically reconstruct the hard way when invoked,    */
  42. /* and write a new ctdlTabl.sys out when finished.  CtdlTabl.sys is    */
  43. /* always destroyed after reading, to minimize the possibility of    */
  44. /* reading an out-of-date version.  In general, the technique works    */
  45. /* well and saves time and head-banging on bootup.  You should,     */
  46. /* however, note carefully the following cautions:            */
  47. /*  o  "char firstExtern;" should >always< be the first         */
  48. /*     declaration in citadel.h                     */
  49. /*  o  "char lastExtern;"  should >always< be the last            */
  50. /*     declaration in citadel.h                     */
  51. /*  o  Whenever you change the declarations in 210Ctdl.h you should:    */
  52. /*   -->  destroy the current ctdlTabl.sys file             */
  53. /*   -->  recompile and reload all citadel programs which access    */
  54. /*      ctdlTabl.sys -- currently citadel.com & configur.com        */
  55. /*   -->  use configur.com to build a new ctdlTabl.sys file        */
  56. /*                                    */
  57. /* If you ignore these warnings, little pixies will prick you in your    */
  58. /* sleep for the rest of your life.                    */
  59.  
  60. /*    stuff to distinguish the various Citadel programs        */
  61. #define CITADEL     0    /* prinipal program            */
  62. #define xxxxx        1    /* unused                */
  63. #define NET        2    /* network downloader    (future)    */
  64. #define ARCHIVE     3    /* backup program    (future)    */
  65. #define CONFIGURE    4    /* configuration program        */
  66. char    weAre;            /* set first thing by main()        */
  67.  
  68. /*            Stuff to size system with:            */
  69. /* WARNING!!! if you expand MAXROOMS beyond 128, horrible, horrible    */
  70. /* things will happen to the userlog entries, which will no longer    */
  71. /* fit in the assigned 256-byte records and will overwrite things    */
  72. /* with normally undesirable results. 82Nov10CrT            */
  73. #ifdef TEST
  74. #define MAXROOMS    6
  75. #define MAXLOGTAB    4
  76. #else
  77.  
  78. #define MAXROOMS       64    /* number of rooms allowed in system    */
  79.  
  80. #define MAXLOGTAB     180    /* number of log entries supported    */
  81.  
  82. #endif
  83.  
  84. #define SECSPERROOM    2    /* sectors/room             */
  85. #define ROOMSECTORS   (MAXROOMS*SECSPERROOM)
  86. #define SECSPERLOG    3    /* three sectors per log record     */
  87. #define LOGSECTORS    (MAXLOGTAB*SECSPERLOG)
  88.  
  89. /*        Stuff nowadays usually in bdscio.h:            */
  90. /* values for functions to return: */
  91. #define TRUE        1
  92. #define FALSE        0
  93. #define ERROR           -1
  94.  
  95. #define SAMESTRING    0    /* value for strcmp() & friend        */
  96.  
  97. /* ASCII characters: */
  98. #define NULL        0
  99. #define SOH        1
  100. #define CNTRLC        3
  101. #define EOT        4
  102. #define ACK        6
  103. #define BELL        7
  104. #define BACKSPACE    8
  105. #define CNTRLI        9    /* aka tab                */
  106. #define TAB        9    /* aka ^I                */
  107. #define NEWLINE        10    /* "linefeed" to philistines.        */
  108. #define CNTRLO           15
  109. #define CNTRLp           16
  110. #define XOFF           19    /* control-s                */
  111. #define NAK           21
  112. #define CAN           24
  113. #define CNTRLZ           26
  114. #define CPMEOF       CNTRLZ
  115. #define ESC           27    /* altmode                */
  116. #define DEL         0x7F    /* delete char                */
  117.  
  118. /* for packing & unpacking ints: */
  119. #define BYTE          256
  120.  
  121. /*            Stuff for rooms:                */
  122. #define LOBBY        0    /* Lobby> is >always< room 0.        */
  123. #define MAILROOM    1    /* Mail>  is >always< room 1.        */
  124. #define AIDEROOM    2    /* Aide> is >always< room 2.        */
  125.  
  126. #define NAMESIZE       20    /* length of room names         */
  127.  
  128. #ifdef TEST
  129. #define MSGSPERRM      58    /* should be >= MAILSLOTS        */
  130. #else
  131. #define MSGSPERRM      58    /* roombuf must be 256 bytes or less.    */
  132. #endif
  133.  
  134. #define FILSPERRM      10    /* roombuf must be 256 bytes or less.    */
  135. #define SECTSIZE      128
  136. char debug;            /* turns debug printout on and off    */
  137. int  roomfl;            /* file descriptor for ctdlRoom.sys    */
  138.  
  139. #define UNREAD        0    /* Only list unread rooms        */
  140. #define ALMOST_ALL    1    /* List both unread and read rooms    */
  141. #define FORGOT        2    /* List forgotten public rooms        */
  142.  
  143. #define INUSE        1    /* flags mask                */
  144. #define PUBLIC        2    /* flags mask                */
  145. #define CPMDIR        4    /* flags mask                */
  146. #define PERMROOM    8    /* flags mask                */
  147. #define SKIP        16    /* (temporary) flags mask for roomTab    */
  148. struct {
  149.     char     rtgen;        /* generation # of room         */
  150.     char     rtflags;        /* public/private flag etc        */
  151.     char     rtname[NAMESIZE];    /* name of room             */
  152.     unsigned rtlastMessage;    /* # of most recent message in room    */
  153. } roomTab[MAXROOMS];
  154.  
  155. struct {
  156.     char     rbgen;        /* generation # of room         */
  157.     char     rbflags;        /* same bits as flags above        */
  158.     char     rbname[NAMESIZE];    /* name of room             */
  159.     char     rbdisk;        /* disk this rooms files are in 0=>none */
  160.     char     rbuser;        /* user area for this rooms files    */
  161.     struct {
  162.     unsigned rbmsgNo;    /* every message gets unique#        */
  163.     int     rbmsgLoc;    /* sector message starts in        */
  164.     } msg[MSGSPERRM];
  165. #ifdef TEST
  166.     char rbOverRun[256];
  167. #else
  168.     char rbOverRun[2];        /* actually unneeded just now -- roomBuf*/
  169. #endif
  170.                 /* is exactly 256 at present        */
  171. } roomBuf;            /* buffer current room is held in    */
  172.  
  173. char thisRoom;            /* room currently in roomBuf    */
  174.  
  175. /*                  userlog stuff                */
  176. #define CRYPTADD      117    /*                    */
  177.  
  178. #define UCMASK        1    /* bit uppercase flag is in        */
  179. #define LFMASK        2    /* bitmask for linefeed flag        */
  180. #define EXPERT        4    /* bitmask for expert-user flag     */
  181. #define TABMASK     8    /* bitmask for tab flag         */
  182. #define AIDE           16    /* bitmask for aide flag        */
  183.  
  184. #define MAILSLOTS      58    /* twiddle to fit logBuf in 384 bytes    */
  185.  
  186. #define GENSHIFT    3    /* lbgen >> GENSHIFT gives generation    */
  187. #define CALLMASK    7    /* lbgen &  CALLMASK gives last visit    */
  188. #define MAXVISIT    8    /* #visits we remember old newestLo for */
  189. #define MAXGEN           32    /* six bits of generation => 64 of them */
  190. #define FORGET_OFFSET  (MAXGEN / 2)    /* For forgetting rooms     */
  191.  
  192. /* logbuf must be 384 bytes or less... including lbOverFlow, 384 or MORE*/
  193. struct logBuffer {
  194.     char      lbnulls;        /* #nulls, lCase, lFeeds        */
  195.     char      lbflags;        /* UCMASK, LFMASK, EXPERT, TABMASK, AIDE*/
  196.     char      lbwidth;        /* terminal width            */
  197.     char      lbname[NAMESIZE]; /* caller's name            */
  198.     char      lbpw[NAMESIZE];    /* caller's password            */
  199.     char      lbgen[MAXROOMS];    /* 6 bits gen, two bits lastvisit    */
  200.     int       lbvisit[MAXVISIT];/* newestLo for this and 3 prev. visits */
  201.     int       lbslot[MAILSLOTS];/* for private mail            */
  202.     unsigned  lbId[MAILSLOTS];    /* for private mail            */
  203. #ifdef TEST
  204.     char      lbOverFlow[256];
  205. #else
  206.     char      lbOverFlow[84];
  207. #endif
  208. } logBuf;
  209.  
  210. int thisLog;            /* entry currently in logBuf        */
  211. int thisSlot;            /* logTab slot logBuf was found via    */
  212.  
  213. int logfl;            /* log file fd                */
  214.  
  215. struct {
  216.     int  ltpwhash;        /* hash of password            */
  217.     int  ltnmhash;        /* hash of name             */
  218.     int  ltlogSlot;        /* location in userlog.buf        */
  219.     int  ltnewest;        /* last message on last call        */
  220. } logTab[MAXLOGTAB];
  221. int sizeLTentry;        /* contains size of a logTab entry    */
  222.  
  223. char loggedIn;             /* global have-caller flag         */
  224.  
  225. /*            terminal stuff                    */
  226. #define SPECIAL        27    /* <ESC>    console escape char    */
  227.  
  228. #define MONTHOFFSET    32    /* for packing month and year in a byte */
  229. char *monthTab[13];        /* month names (we don't use loc 0)    */
  230. char filter[128];        /* input character translation table    */
  231.  
  232. char prevChar;            /* for EOLN/EOParagraph stuff        */
  233. char expert;            /* true to suppress hints & noise    */
  234. char termWidth;         /* width to format output to        */
  235. char termUpper;         /* uppercase-only flag            */
  236. char termLF;            /* LF-after-CR flag            */
  237. char termTab;            /* has-tabs flag            */
  238. char aide;            /* aide-privileges flag         */
  239. char termNulls;         /* #nulls to send at eoln        */
  240. char justLostCarrier;        /* room2.c / rmmodem.c    communication    */
  241. char crtColumn;         /* current position on screen        */
  242.  
  243. char newCarrier;
  244. char onConsole;
  245. int  Ooops;
  246. #define MAXTEXT      3500    /* maximum chars in edit buffer     */
  247.  
  248. /*            message stuff                    */
  249. struct {
  250.     char mbtext[MAXTEXT]  ;    /* buffer text is edited in        */
  251.  
  252.     int  mbheadChar      ;    /* start of message            */
  253.     int  mbheadSector      ;    /* start of message            */
  254.  
  255.     char mbauth[ NAMESIZE];    /* name of author            */
  256.     char mbdate[ NAMESIZE];    /* creation date            */
  257.     char mbId[     NAMESIZE];    /* local number of message        */
  258.     char mboname[NAMESIZE];    /* short human name for origin system    */
  259.     char mborig[ NAMESIZE];    /* US 206 633 3282 style ID        */
  260.     char mbroom[ NAMESIZE];    /* creation room            */
  261.     char mbsrcId[NAMESIZE];    /* message ID on system of origin    */
  262.     char mbto[     NAMESIZE];    /* private message to            */
  263. } msgBuf;
  264.  
  265. int msgfl;        /* message file fd--packed leaky circular queue */
  266.  
  267. char sectBuf[SECTSIZE];     /* temporary buffer for random access    */
  268.  
  269. char GMCCache;            /* to unGetMsgChar() into        */
  270.  
  271. int oldChar;            /* old value of thisChar        */
  272. int oldSector;            /* old value of thisSector        */
  273.  
  274. int thisChar;            /* next char in sectBuf         */
  275. int thisSector;         /* next sector in msgfl         */
  276.  
  277. int catChar;        /* as in cat-and-mouse queue, or conCATenation. */
  278. int catSector;            /* where to write next message        */
  279.  
  280. unsigned oldestLo, oldestHi;    /* 32-bit ID# of first message in system*/
  281. unsigned newestLo, newestHi;    /* 32-bit ID# of last  message in system*/
  282.  
  283. int maxMSector;         /* # sectors (used) in ctdlmsg.sys    */
  284.  
  285.  
  286. /* values for showMess routine */
  287. #define NEWoNLY     0
  288. #define OLDaNDnEW    1
  289. #define OLDoNLY     2
  290. #define GLOBALnEW    3
  291.  
  292. /*            modem stuff                    */
  293. /* somestuff readfile() and sendfile() like:    */
  294. #define LOOPSPERSEC  5000
  295. #define ERRORMAX       10
  296. #define RETRYMAX       10
  297. #define MINUTE           60
  298. #define STARTUP     1
  299. #define FINISH        2
  300.  
  301. /* sendFile() globals                            */
  302. char WCSecNum;
  303. char WCBuf[SECTSIZE];
  304. char WCChar;
  305. char WCError;
  306.  
  307. /* fiddle factor to timeout on no input: */
  308. #define HITIMEOUT    2    /* count seems to be about 30 sec    */
  309.  
  310. #define NEWCARRIER   0x01    /* returned to main prog on login    */
  311.  
  312. #define MODEM        0    /* current user of system is        */
  313. #define CONSOLE     1    /* one of these             */
  314. char modStat;            /* whether modem was on line        */
  315.                 /* LAST time it was checked        */
  316.  
  317. char noChat;            /* TRUE to suppress chat attempts    */
  318. char whichIO;            /* CONSOLE or MODEM            */
  319. char visibleMode;        /* make non-printables visible?     */
  320. char haveCarrier;        /* set if DCD == TRUE            */
  321. char exitToCpm;         /* system is being brought down     */
  322.  
  323. char textDownload;        /* read host files, TRUE => ASCII    */
  324.  
  325. /*  output XON/XOFF etc flag... */
  326. #define OUTOK        0    /* normal output            */
  327. #define OUTPAUSE    1    /* a pause has been requested        */
  328. #define OUTNEXT     2    /* quit this message, get the next    */
  329. #define OUTSKIP     3    /* stop current process         */
  330. #define OUTPARAGRAPH    4    /* skip to next paragraph        */
  331. char outFlag;            /* will be one of the above        */
  332.  
  333. #define NEITHER     0    /* don't echo input            */
  334. #define CALLER        1    /* echo to caller only --passwords etc    */
  335. #define BOTH        2    /* echo to caller and console both    */
  336.  
  337. char echo;            /* will be one of above three        */
  338.  
  339. /* scratch externals for speed-critical code:    */
  340. char *fpc1, *fpc2, *fpc3;
  341. char   fc1,   fc2,   fc3;
  342. int    fi1,   fi2,   fi3;
  343.  
  344. char usingWCprotocol;        /* true during Ward Christensen-    */
  345.                 /* protocol file/message transfers.    */
  346.  
  347. /*    stuff for the mini-INTRPreter that drives the modem:        */
  348. /* opcodes for the interpreter: */
  349. #define ANDI        1
  350. #define INP        2
  351. #define LOAD        3
  352. #define LOADI        4
  353. #define ORI        5
  354. #define OUTP        6
  355. #define OUTSTRING    7
  356. #define PAUSEI        8
  357. #define RET        9
  358. #define STORE           10
  359. #define XORI           11
  360. #define STOREX           12
  361. #define LOADX           13
  362. #define OPRNUMBER      14
  363. #define TOBDC           15
  364. #define TODEC           16
  365. #define RET0           17 /* */
  366. #define RET1           18 /* */
  367. #define BOUT        19
  368.  
  369. #define MAXCODE       512
  370. char codeBuf[MAXCODE];    /* buffer for configuration routines    */
  371. char scratch[40];    /* scratch space for config routines    */
  372. char shave[8];        /* shave-and-a-haircut/2 bits pauses    */
  373.  
  374. /* routine addresses in codeBuf: */
  375. char *pHangUp, *pCarrDetect, *pMIReady, *pMOReady, *pInitPort;
  376. char *pInitDate, *pGetDay, *pGetMonth, *pGetYear;
  377.  
  378. /*        get/put message stuff                    */
  379. char pullMessage;        /* true to pull current message     */
  380. int  pulledMLoc;        /* loc of pulled message        */
  381. int  pulledMId;         /* id number of message to be pulled    */
  382.  
  383.  
  384. /*        buffered file I/O stuff                 */
  385. #define NSECTS        8    /*  8 sectors == 1024 byte buffer    */
  386.  
  387. #define BUFSIZ        (NSECTS * SECTSIZE + 7)     /* 1.50a version */
  388.  
  389. struct    _buf {
  390.     int  _fd;
  391.     int  _nleft;
  392.     char *_nextp;
  393.     char _buff[NSECTS * SECTSIZE];
  394.     char _flags;
  395. };
  396.  
  397. /* file control block structure, for doing directories: */
  398. struct fcb {
  399.     char    fcbDr;        /* drive number             */
  400.     char    fcbfName[8];    /* file name                */
  401.     char    fcbfExt[3];    /* file extention            */
  402.  
  403.     char    fcbEx;        /* file extent -- usually 0        */
  404.  
  405.     char    fcbS1;        /* mysterious BDOS byte         */
  406.     char    fcbS2;        /* same, zero for open, make, search    */
  407.  
  408.     char    fcbRC;        /* record count in this extent, 0-128    */
  409.  
  410.     char    fcbdMap[16];    /* bitmap?                */
  411.  
  412.     char    fcbCr;        /* current record -- initialize to 0    */
  413.  
  414.     unsigned    fcbRecn;    /* highest record number        */
  415.     char    fcbRecOvfl;    /* overflow of above            */
  416. };
  417.  
  418. /* some more stuff for doing directories: */
  419. #define FINDfIRST      17    /* BDOS call to find first match    */
  420. #define FINDnEXT       18    /* BDOS call for next directory match    */
  421.  
  422. #define SETdMA           26    /* BDOS call                */
  423.  
  424. #define SETdISK        14    /* BDOS call                */
  425. #define SETuSER        32    /* BDOS call                */
  426.  
  427. #define GETfILEsIZE    35    /* BDOS call                */
  428.  
  429. int  FDSectCount;        /* fileDirectory() keeps a count here    */
  430.  
  431. char lastExtern;       /* this should ALWAYS be the last declaration  */
  432. 
  433.     char    fcbfName[8];    /* file name                */
  434.